home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
pcl
/
docs.lha
/
latex-CLTL-sty
/
more-info.txt
/
node14_mn.html
< prev
next >
Wrap
Text File
|
1991-07-02
|
2KB
|
48 lines
<H2><A ID="SECTION00183000000000000000">
Simple Iteration Constructs</A>
</H2>
<P>
The constructs <#2539#>dolist<#2539#> and <#2540#>dotimes<#2540#> execute a body of code
once for each value taken by a single variable. They are expressible
in terms of <#2541#>do<#2541#>, but capture very common patterns of use.
<P>
Both <#2542#>dolist<#2542#> and <#2543#>dotimes<#2543#> perform
a body of statements repeatedly. On each iteration a specified
variable is bound to an element of interest that the body may
examine. <#2544#>dolist<#2544#> examines successive elements of a list,
and <#2545#>dotimes<#2545#> examines integers from 0 to <tex2html_image_mark>#tex2html_wrap_inline6452# - 1
for some specified positive integer <#2547#><I>n</I><#2547#>.
<P>
The value of any of these constructs may be specified by an optional result
form, which if omitted defaults to the value <#2548#><#2548#>.
<P>
The <#2549#>return<#2549#> statement may be used to return
immediately from a <#2550#>dolist<#2550#> or <#2551#>dotimes<#2551#> form,
discarding any following iterations
that might have been performed; in effect, a <#2552#>block<#2552#> named <#2553#><#2553#>
surrounds the construct.
The body of the loop is implicitly a <#2554#>tagbody<#2554#> construct;
it may contain tags to serve as the targets of <#2555#>go<#2555#> statements.
Declarations may appear before the body of the loop.
<P>
<BR>
<tex2html_image_mark>#defmac2556#
<BR>
<P>
<BR>
<tex2html_image_mark>#defmac2582#
<BR>
<P>
See also <#2626#>do-symbols<#2626#>, <#2627#>do-external-symbols<#2627#>,
and <#2628#>do-all-symbols<#2628#>.
<P>